<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>如何给jQuery添加方法</title>
</head>

<body>
    <div id="tel">15912345678</div>
    <div id="text">今天是星期六，明天休息，好开心，准备找好朋友玩</div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <script src="../js/bing.js"></script>
    <script>
        // console.log(_.isLeepYear(2020));
        // console.log(_.isLeepYear(2021));
        // $('#tel').text(_.telMosaic($('#tel').text()))
        // $('#text').text(_.Mosaic($('#text').text()))

       
        console.log($.isLeepYear(2020));
        console.log($.isLeepYear(2021));
        $('#tel').text($.telMosaic($('#tel').text()))
        $('#text').text($.Mosaic($('#text').text()))
        console.log('--------------------');
        let zs = {
            playball:function(){
                console.log('会打球');
            }
        }
        let ls = {
            study:function(){
                console.log('会学习');
            }
        }
        // $.extend()方法，传多个对象，表示后面的对象给第一个对象扩展方法
        $.extend(zs,ls)
        zs.playball()
        zs.study()
        console.log('--------------------');
        //$是jQuery对象
        //$.fn是jQuery的实例对象
        $.fn.extend({
            red(){
                this.css('color','red')
            },
            green(){
                this.css('color','green')
            }
        })
        // $('#tel').css('color','red')
        // $('#text').css('color','green')
        $('#tel').red()
        $('#text').green()
    </script>
</body>

</html>